package com.tjetc.controller;

import com.tjetc.common.Resp;
import com.tjetc.entity.Notice;
import com.tjetc.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@RequestMapping("notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    @RequestMapping("getAll")
    Resp getAll(){
        return noticeService.getAllNotice();
    }

    @RequestMapping("release")
    Resp release(@RequestBody Notice notice){
        System.out.println(notice);
        return noticeService.releaseNotice(notice);
    }
}
